package com.abc.wy.exception;

public enum SCErrorCode implements IErrorCode {
    UNKNOWN_EXCEPTION(500,"","system error"),
    DEMO_EXCEPTION(30000, "demo exception", "示例异常"),
    DUPLICATE_KEY_EXCEPTION(30001, "duplicate key exception", "数据库中已存在该记录"),
    AUTHORIZATION_EXCEPTION(30002, "authorization exception", "权限校验失败");

    private int code;
    private String errorMessage;
    private String userMessage;

    @Override
    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    @Override
    public String getErrorMessage() {
        return errorMessage;
    }

    public void setErrorMessage(String errorMessage) {
        this.errorMessage = errorMessage;
    }

    @Override
    public String getUserMessage() {
        return userMessage;
    }

    public void setUserMessage(String userMessage) {
        this.userMessage = userMessage;
    }

    SCErrorCode(int code, String errorMessage, String userMessage) {
        this.code = code;
        this.errorMessage = errorMessage;
        this.userMessage = userMessage;
    }

    @Override
    public String toString() {
        return "错误码: " + code + ", user message: " + userMessage + ", error message: " + errorMessage;
    }

}
